Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Conditionalize units which require a boot disk #102

Merged
merged 3 commits into from
Sep 16, 2019
Merged

Conditionalize units which require a boot disk #102

merged 3 commits into from
Sep 16, 2019

Conversation

bgilbert
Copy link
Contributor

@bgilbert bgilbert commented Sep 5, 2019

On live PXE or ISO boots, skip units which operate on a boot disk.

Part of coreos/fedora-coreos-config#155.

@bgilbert
Copy link
Contributor Author

Updated to fix ignition-diskful.target failing to pull in any units.

Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial comments. will add some more tomorrow after testing artifacts


# Make sure if any ExecStart= fail, the boot fails. This normally would
# already be guaranteed by `initrd.target` failing, but that doesn't seem to be
# enough: https://bugzilla.redhat.com/show_bug.cgi?id=1696796
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks to be copied from igniton-complete.target. According to the BZ the bug only affects f29 so maybe we can drop this now? cc @jlebon as this was first added in 549002e

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried dropping the stanza from ignition-complete.target, and that causes systemd to loop in the initrd if ignition-files fails. With the stanza, it properly fails the boot. So, still needed.

On the other hand, if a dependency of ignition-diskful.target fails, systemd doesn't fail the boot with or without this stanza. 🙁

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I recalled this working on f30. I guess systemd might've regressed on git master too? If that's the case, we should be able to file an issue upstream for this where it'll hopefully get more exposure. (The only reason I made it an RHBZ was that upstream only wants bugs that reproduce against N and N-1).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would definitely be nice if we could get this fixed in at least f31

@@ -0,0 +1,16 @@
# This target contains Ignition units that should only run when we have
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've been trying to think of a better name than ignition-diskful.target but I haven't come up with any clear winners. ignition-withbootdisk.target was an initial thought but meh..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diskful being the opposite of diskless 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like ignition-bootloader.target, diskful doesn't quite convey the entire context that it's specifically for units targeting the boot disk.

I'd also be fine leaving it as is given the comments in the target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it doesn't. Those units aren't really related to the bootloader, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

others possibles: ignition-withharddisk.target ignition-bootedfromdisk.target blah blah blah :)

diskful being the opposite of diskless slightly_smiling_face

You know this might sound dumb, but putting that exact word in the description of this target unit file might actually help it click for people.

i.e. when we're not running diskless from a live image out of RAM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know this might sound dumb, but putting that exact word in the description of this target unit file might actually help it click for people.

Good point. Updated.

Copy link
Contributor

@arithx arithx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM

@@ -0,0 +1,16 @@
# This target contains Ignition units that should only run when we have
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like ignition-bootloader.target, diskful doesn't quite convey the entire context that it's specifically for units targeting the boot disk.

I'd also be fine leaving it as is given the comments in the target.

Add ignition-diskful.target, containing units that expect a writable
boot disk.  Enable it from the generator unless there's a command
"is-live-image" which returns 0.
In live boots there's no /boot partition with a flag file to remove.
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - I've written down this item as a followup:

Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

install_ignition_unit ignition-disks.service
install_ignition_unit ignition-mount.service
install_ignition_unit ignition-files.service
install_ignition_unit ignition-remount-sysroot.service

# units only started when we have a boot disk
Copy link
Member

@cgwalters cgwalters Sep 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if it'd be cleaner to have the units test ConditionPathExists=!/run/ostree-live instead? I don't have a strong opinion though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these except ignition-remount-sysroot.service pull in device dependencies, so they have to be enabled via generator. Conditions are only evaluated after dependencies are pulled in.

@bgilbert bgilbert merged commit cbac371 into coreos:master Sep 16, 2019
@bgilbert bgilbert deleted the live branch September 16, 2019 19:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants